package teshop.data.dao;

import java.io.Serializable;
import java.util.List;

/**
 * DAO for object existing in a database in general.
 * 
 * @author Hryhory Lira
 *
 * @param <T> type of the object
 * @param <ID> type of unique id
 */
public interface GeneralDAO<Type, ID extends Serializable> {
	
	/**
	 * @return object by its id
	 */
	public Type getByID(ID id);
	
	/**
	 * Creates new object
	 */
	public void save(Type object);
	
	/**
	 * Updates an object
	 * @param object new object
	 */
	public void update(Type object);
	
	/**
	 * Deletes an object
	 * @param object object to delete
	 */
	public void delete(Type object);
	
	/**
	 * @return list of all objects in database
	 */
	public List<Type> getAll();

}
